<template>
  <vxe-modal
    title="查看物资盘点详情"
    v-model="dialogVisible"
    v-if="dialogVisible"
    :loading="loading"
    width="88%" showFooter esc-closable show-zoom resize>

    <div style="height: 75vh; overflow-y: auto;">
      <el-card class="box-card" shadow="never" :body-style="{ padding: '10px',backgroundColor: '#bfcdda' }">
        <!-- 物资盘点基本信息 -->
        <el-card class="box-card" shadow="hover">
          <div slot="header" class="clearfix">
            <span style="font-size: 16px; color: #1890ff;">物资盘点基本信息</span>
          </div>
          <el-descriptions class="margin-top" :column="2" size="medium" border
                           :contentStyle="content_style" :labelStyle="label_style">
            <el-descriptions-item>
              <template slot="label">
                <div class="right-align-label">
                  <i class="el-icon-user"></i>
                  盘点日期：
                </div>
              </template>
              {{ wzPdData.pdTime }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label">
                <div class="right-align-label">
                  <i class="el-icon-user"></i>
                  盘点人：
                </div>
              </template>
              {{ wzPdData.pdName }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label">
                <div class="right-align-label">
                  <i class="el-icon-user"></i>
                  盘点备注：
                </div>
              </template>
              {{ wzPdData.pdBz }}
            </el-descriptions-item>

          </el-descriptions>
        </el-card>
        <br>
        <!-- 盘点明细信息 -->
        <el-card class="box-card" shadow="hover" style="min-height: 25vh">
          <div slot="header" class="clearfix">
            <span style="font-size: 16px; color: #1890ff;">盘点明细信息</span>
          </div>
          <el-table :header-cell-style="{background:'#d0cece',color:'#000000',fontWeight:'bold'}"
                    height="45vh" :data="wzpdPdmxList" ref="sbdbDbmx">
            <!--            <el-table-column type="selection" width="50" align="center"/>-->
            <el-table-column label="序号" align="center" type="index" width="50"/>
            <el-table-column show-overflow-tooltip align="center" label="物资名称" prop="wzName">
            </el-table-column>
            <el-table-column show-overflow-tooltip align="center" label="物资单位" prop="wzDw"/>
            <el-table-column show-overflow-tooltip align="center" label="仓库名称" prop="ckName"/>
            <el-table-column show-overflow-tooltip align="center" label="货架名称" prop="hjName"/>
            <el-table-column show-overflow-tooltip align="center" label="分层名称" prop="fcName"/>
            <el-table-column show-overflow-tooltip align="center" label="物资分类" prop="wzFl"/>
            <el-table-column show-overflow-tooltip align="center" label="物资规格" prop="wzGg"/>
            <el-table-column show-overflow-tooltip align="center" label="物资专业" prop="wzZy"/>
            <el-table-column show-overflow-tooltip align="center" label="单价" prop="dj"/>
            <el-table-column align="center" label="清查数量">
              <el-table-column align="center" label="账面">
                <el-table-column show-overflow-tooltip align="center" label="数量" prop="kc"/>
                <el-table-column show-overflow-tooltip align="center" label="金额" prop="zmJe"/>
              </el-table-column>
            </el-table-column>
            <el-table-column align="center" label="盘点">
              <el-table-column align="center" label="数量" prop="pdSl"/>
              <el-table-column align="center" label="金额" prop="pdJe"/>
            </el-table-column>
            <el-table-column align="center" label="盈" prop="dj">
              <el-table-column align="center" label="数量" prop="ySl"/>
              <el-table-column align="center" label="金额" prop="yJe"/>
            </el-table-column>
            <el-table-column align="center" label="亏" prop="dj">
              <el-table-column align="center" label="数量" prop="kSl"/>
              <el-table-column align="center" label="金额" prop="kJe"/>
            </el-table-column>
            <el-table-column show-overflow-tooltip align="center" label="备注" prop="bz" width="150"/>
          </el-table>
        </el-card>
      </el-card>
    </div>
    <div slot="footer" class="dialog-footer dialog-footer-center">
      <el-button @click="dialogVisible=false">关闭</el-button>
    </div>

    <!-- 物资详情 -->
    <WzXq ref="wzXq"/>
  </vxe-modal>
</template>
<script>
import WzXq from "@/views/wzgl/wzxx/components/WzXq.vue";
import {getWzck} from "@/api/wzgl/wzck";
import {getWzpd} from "@/api/wzgl/wzpd";

export default {
  name: "WzPdXq",  //物资盘点详情界面
  components: {WzXq},
  dicts: ['sbdb_dbzt'],
  data() {
    return {
      wzpdId: null, //物资盘点主键ID
      loading: false,
      wzPdData: [], //物资出库基本信息
      wzpdPdmxList: null, //物资盘点明细表格
      dialogVisible: false,
      content_style: {
        // 解决不对齐的问题
        'width': "400px",
        // 排列第二行
        'word-break': 'break-all',
        // 'background-color': '#f3f7ff'
      },
      label_style: {
        // 解决不对齐的问题
        'width': "250px",
        // 排列第二行
        'word-break': 'break-all',
        'background-color': '#F0F8FF'
      },
    };
  },
  created() {
  },
  methods: {
    handleOpen(row) {
      this.loading = true;
      this.wzpdId = row.wzpdId
      this.dialogVisible = true
      this.getWzPdData()
      setTimeout(() => {
        this.loading = false
      }, 1000)
    },
    //获取详情数据
    getWzPdData() {
      const wzpdId = this.wzpdId
      getWzpd(wzpdId).then(res => {
        this.wzPdData = res.data
        this.wzpdPdmxList = res.data.wzpdPdmxList;
      })
    },
    // 查看物资详情信息
    handleButtonClick(row) {
      this.$refs.wzXq.handleOpen(row);
    },

  }
};
</script>

<style scoped>
.right-align-label {
  text-align: right;
}

/* 定义表头中特定类名的文本居中 */
.el-table .custom-header .cell {
  text-align: center !important;
}
/* header 头部背景 */
/deep/ .el-card__header {
  padding: 3px 7px 3px;
  min-height: 10px;
  background-color: aliceblue;
}
</style>
